package com.cisetech.web.bobocai.qiantai;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.cisetech.service.ContentService;
import com.cisetech.vo.bobocai.LContent;

@Controller
@RequestMapping(value="content")
public class ContentController {
	
	@Autowired
	ContentService contentService;
	
	@RequestMapping(value="",method=RequestMethod.GET)
	public String index(Model model,LContent content,HttpServletRequest request,HttpServletResponse response){
		List<LContent> list = contentService.findContent(content);
		if(list!=null && list.size()>0){
			model.addAttribute("content", list.get(0));
		}else{
			model.addAttribute("content", list.get(0));
		}
		if("e".equals(request.getParameter("e"))){
			return "qiantai/e/content";
		}
		return "qiantai/content";
	}
}
